Skip to content

Add deterministic procedural mesh toolkit (procgen) with primitives, spline extrusion, lathe, segments, SDF/volume & shell demo - #17

Merged
ercmine merged 1 commit into
mainfrom
codex/implement-procedural-mesh-toolkit
Apr 6, 2026
Merged

Add deterministic procedural mesh toolkit (procgen) with primitives, spline extrusion, lathe, segments, SDF/volume & shell demo#17
ercmine merged 1 commit into
mainfrom
codex/implement-procedural-mesh-toolkit

Conversation

@ercmine

@ercmine ercmine commented Apr 6, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Implement Statement 17 by adding an engine-owned, deterministic procedural mesh foundation to produce reusable CPU-side geometry for rooms, bugs, items, props, VFX, and tools.
  • Provide a compact, renderer-agnostic API that feeds the existing CpuMeshData/renderer upload path while remaining deterministic and testable.
  • Deliver practical generation modes (primitives, spline extrusion, lathing, segment assembly, voxel-like scalar fields, and SDF composition + extraction) rather than a full DCC/editor system.

Description

  • Added a new module engine/procgen exposing procgen.hpp/procgen.cpp with ProcVertex, generation entry points (primitives, extrude_profile_along_path, lathe_profile, assemble_segments), scalar field and SDF composition helpers, marching-tetrahedra extraction, and mesh post-process/validation utilities.
  • Implemented core primitives (make_quad, make_plane, make_box, make_uv_sphere, make_cylinder, make_cone, make_torus, make_capsule), spline utilities (Catmull‑Rom sampling + frame derivation), extrusion and lathe generation, deterministic segment assembly using core::Seed/core::Random splits, ScalarField storage, and SDF primitives/composition functions.
  • Integrated procgen into the build (CMakeLists.txt) and added tests/procgen/procgen_tests.cpp exercising primitive/spline/lathe/segment/SDF/extraction determinism and validation, plus updated the runtime shell (engine/shell/main.cpp) to upload and render representative generated meshes via existing create_mesh_buffer/create_index_buffer APIs.
  • Added documentation docs/procgen.md and updated docs/architecture.md to describe organization, determinism, generation conventions, integration, and known limits.

Testing

  • Attempting a full CMake configure/build with cmake --preset linux-debug failed in this environment due to missing third-party dependencies (SDL3/bgfx), so the full CMake run could not be completed here.
  • Performed syntax/compile checks with g++ -std=c++20 -I. -fsyntax-only engine/procgen/procgen.cpp tests/procgen/procgen_tests.cpp and g++ -std=c++20 -I. -fsyntax-only engine/shell/main.cpp, both of which succeeded.
  • Built and ran a standalone test binary with g++ -std=c++20 -I. tests/procgen/procgen_tests.cpp engine/procgen/procgen.cpp engine/render/buffer_types.cpp engine/core/math.cpp engine/core/transform.cpp engine/core/random.cpp engine/core/hash.cpp -o /tmp/procgen_tests && /tmp/procgen_tests, and the procgen test ran successfully (assertions passed).
  • Registered render_procgen_tests in CMake and added CTest entry unit.procgen.mesh_toolkit so the suite will run under CI once external dependencies are present.

Codex Task

@ercmine
ercmine merged commit 6ad065d into main Apr 6, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant